<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
		<style>
			body, html {
				background-color: white
			}
		</style>
	</head>
	<body>
		<h1>PACP Query Language(PQL)</h1>
		<h2>What is PQL?</h2>
		<p>PQL is designed to facilitate seaching PACP databases.</p>
		<h2>Search Inspection</h2>
		<h3>Available Fields</h3>
		<p>date, 'dia', 
		'Rim_to_Grade_(D)', 'City', 'Upstream_MH', 
	'PO_Number', 'Rim_to_Invert_(D)', 'Surveyor_Name', 'Pipe_Joint_Length', 'Structural_Grading', 'Pre-Cleaning', 'Year_Renewed', 'Location_Details', 'Additional_Info', 'Grade_to_Invert_(U)', 'Year_Laid', 'Length_Surveyed', 'Material', 'Direction_of_Survey', 'Rim_to_Invert_(U)', 'Grade_to_Invert_(D)', 'Location_Code', 'Weather', 'RunID', 'MPEGPath', 'Pipe_Segment_Reference', 'Purpose', 'Customer', 'DiscName', 'Height_(Diameter)', 'Certificate_Number', 'Time', 'Date_Cleaned', 'Drainage_Area', 
	'DesignSlope', 'Width', 'Downstream_MH', 'Media_Label', 'EndFrame', 'PIPETECHID', 'Shape', 'Sewer_Use', 'Lining_Method', 'Flow_Control', 'Sewer_Category', 'Owner', 'Total_Length', 'Rim_to_Grade_(U)', 'Street'];
  </p>
		<h3>Example 1: Find inspections to MH 00034S0006</h3>
		<pre>PIPETECHID:=0034S0006</pre>
		<h2>Search Defects</h2>
		<h3>Example 1: Find inspections with more than 2 MGOs</h3>
		<pre>MGO>2</pre>
		<h3>Example 2: Find inspections with roots problems</h3>
		<pre>R??>0</pre>
		<h3>Example 3: Find inspections with joint offsets but without roots problems at joints</h3>
		<pre>JO?>0, R?J<0</pre>
		<h2>Summary</h2>

		<p>A PQL is composed of rules, rules are seperated by comma(,). Each rule has 3 parts, namely<br/>
		<h3>Defect Search</h3>
		<table border='1'>
			<tr><td>MGO</td><td>Defect</td><td>wild card "?" can be used. eg. R??</td></tr>
			<tr><td>></td><td>Operator</td><td>Available operators: >, <, =, >=, <=</td></tr>
			<tr><td>3</td><td>The count</td><td>The count of the condition code</td></tr>			
		</table>
		<h4>Inspection Attribute Search</h4>
		<table border='1'>
			<tr><td>PIPETECHID</td><td>Name of the attribute</td><td>Attribute name</td></tr>
			<tr><td>:=</td><td>Operator</td><td>Compare the value on either side of ":="</td></tr>
			<tr><td>003S</td><td>The value</td><td>The value of the attribute, currently only text field are supported.</td></tr>			
		</table>
		</p>
		

		
	</body>
</html>
